home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
C!T ROM 3
/
ct-rom iiib.zip
/
ct-rom iiib
/
WINDOWS
/
UTILITY
/
DESKTOP
/
W_ONE49
/
MERGE.CP_
/
MERGE.CP
Wrap
Text File
|
1994-04-27
|
3KB
|
85 lines
/******************************************************************\
* *
* w w oooo *
* w w iii n n o o n n eeee *
* w w i nn n o o nn n e *
* w w w i n n n o o n n n eee *
* w w w w i n nn o o n nn e *
* w w iii n n oooo n n eeee *
* *
* C o m m a n d L a n g u a g e I n t e r p r e t e r *
* *
* *
* External Command MERGE *
* Written by Lucien Cinc *
* Copyright (c) 1993 *
* *
\******************************************************************/
#include "merge.h"
int merge(void); // proto type
int main(void)
{
char *sp;
sp = args(); // parse command line switches
while(*sp)
switch(*sp++) {
case 'v' : // show version information
printf("%cVersion %c%d.%01d\n", WHITE, YELLOW, VERSION / 10, VERSION % 10);
return 0;
default: // invalid switch
perror("Invalid switch");
return 1;
}
if (argnstr()) { // no command line string arguments
perror("Invalid argument");
return 1;
}
if (argc() != 3) { // no command line arguments
perror("To many or few arguments");
return 1;
}
return merge();
}
int merge(void)
{
long num1, num2;
char dst[MAXPATH], src1[MAXPATH], src2[MAXPATH];
strcpy(dst, argpath(3)); // destination file
strcpy(src1, argpath(1)); // first file
strcpy(src2, argpath(2)); // second file
if ((num1 = filesize(src1)) == -1) { // get first file size
perror("Invalid path or file name");
return 1;
}
if ((num2 = filesize(src2)) == -1) { // get second file size
perror("Invalid path or file name");
return 1;
}
limit(num1 + num2); // status bar limit
if (filecpy(dst, src1, O_CREATNEW, INC_BYTE) == -1) {
empty();
return 1;
}
if (filecat(dst, src2, INC_BYTE) == -1) {
empty();
return 1;
}
empty(); // finished with status bar
return 0;
}